package com.yyaccp.easybuy.security.vo;

import java.util.Map;

/**
 * 适配各平台的用户信息对象
 */
public class SnsUserInfo {
    private Map<String, String> userInfoMap;

    public SnsUserInfo(Map<String, String> userInfoMap) {
        this.userInfoMap = userInfoMap;
    }

    public String getUserId() {
        return String.valueOf(userInfoMap.get("id"));
    }

    public String getLoginName() {
        return userInfoMap.get("login");
    }

    public String getNickName() {
        return (userInfoMap.get("name") == null ? userInfoMap.get("nick") :  userInfoMap.get("name"));
    }

    public String getAvatarUrl() {
        return userInfoMap.get("avatar_url");
    }
}
